import React from "react";
import { Card, message, Typography } from "antd";
import "./index.scss";
import defaultCover from "../../assets/image/default.webp";
export default function CardCoverItem({
  info,
  handlerInfoClick = () => {
    message.info("没传参数，呆逼");
  },
  handlerType = "id",
  title = info.title,
  cover = <img className="card-cover-img" src={info.cover || defaultCover} />,
  isClickImg = true,
}) {
  return (
    <Card
      bodyStyle={{
        padding: "10px 0",
      }}
      bordered={false}
      hoverable
      cover={cover}
      onClick={
        isClickImg
          ? () => {
              handlerInfoClick(info[handlerType]);
            }
          : () => {}
      }
    >
      <Typography.Paragraph
        ellipsis={true}
        className="center"
        onClick={() => {
          handlerInfoClick(info[handlerType]);
        }}
      >
        {title}
      </Typography.Paragraph>
    </Card>
  );
}
